# 普通方式实现部门增删改查
import requests


from common.get_token import grt_login_token

token = grt_login_token()
id ='1524718558175645696'
# 添加部门
resp = requests.post('http://ihrm-test.itheima.net/api/company/department', headers={"Authorization": token},
                     json={"name": "杀猪部", "code": "666888"})
print('添加部门', resp.json())


# 修改部门
resp = requests.put('http://ihrm-test.itheima.net/api/company/department/' + id, headers={"Authorization": token},
                    json={"name": "卖猪部", "code": "6668888"})
print('修改部门', resp.json())

# 查询部门
resp = requests.get('http://ihrm-test.itheima.net/api/company/department/' + id, headers={"Authorization": token})
print('查询部门', resp.json())

# 删除部门
resp = requests.delete('http://ihrm-test.itheima.net/api/company/department/' + id, headers={"Authorization": token})
print('删除部门', resp.json())